import { request } from "@/utils/http";
import { getProvinceReturnType } from "./model/hospitalListTypes";
import {
    getHosListSearchParamsType,
    hospitalListReqReturnType,
    hospitalDetailReturnType,
    hosDepartmentListType,
    hosScheduleRuleParamsType,
    hosScheduleRuleReturnType,
    findScheduleListParamsType,
    findScheduleListType

} from "./model/hospitalListTypes";

export const getHospitalListRequest = (page:number,limit:number,searchParams:getHosListSearchParamsType)=>{
    return request.get<any,hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`,{
        params:searchParams
    })
}
//请求发送省份数据
export const   getProvinceRequest = ()=>{
    return   request.get<any,getProvinceReturnType>('/admin/cmn/dict/findByDictCode/province')
}
//请求发送 市的数据
export const getCityOrDistrictRequest = (value:string)=>{
    return request.get<any,getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${value}`)
}
//请求医院详情信息
export  const getHosListDetailRequest = (id:string)=>{
return request.get<any,hospitalDetailReturnType>(`/admin/hosp/hospital/show/${id}`)
}
//更改上下线的逻辑
export const changeStatusRequest = (id:string,num:0|1)=>{
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${num}`)
}
//医院科室的请求
export const  hosScheduleListRequest  = (hoscode: string)=>{
    return request.get<any, hosDepartmentListType>(`/admin/hosp/department/${hoscode}`);
}
//某个科室的详细排版时间请求
export const hosScheduleRuleRequest =({ page, limit, hoscode, depcode}:hosScheduleRuleParamsType)=>{
    return   request.get<any, hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}
//获取某个科室某个时间的具体详情
 export const  findSchedulListRequest = ({ hoscode, depcode, workDate }:findScheduleListParamsType)=>{
    return request.get<any, findScheduleListType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
 }
